public class Mall {
    String mallName;
    String adresss;
    Card1[] c = new Card1[100];//建立单个会员对象
    int count = 0;

    public boolean add(String newCardNo, String newName, String newNumber, int newScore) {
        if (count >= c.length) {
            System.out.println("人数已满");
            return false;
        }
        c[count] = new Card1();
        c[count].cardNo = newCardNo;
        c[count].name = newName;
        c[count].number = newNumber;
        c[count].score = newScore;
        count++;
        return true;
    }

    public void show() {
        System.out.println("显示会员信息");
        System.out.println("序号\t姓名\t会员卡号\t会员手机号\t会员积分");
        for (int i = 0; i < count; i++) {
            System.out.println((i + 1) + " \t " + c[i].name + " \t " + c[i].cardNo + "\t  " + c[i].number + " \t" + c[i].score);
        }

    }

    public void shoMall() {
        System.out.println("商场名称" + mallName);
        System.out.println("商场地址" + adresss);
        System.out.println("商场会员数" + count);
    }

    public boolean increaseScore(String cardNo, int score) {
        for (int i = 0; i < count; i++) {
            if (c[i].cardNo.equals(cardNo)) {
                c[i].score += score;
                System.out.println("积分添加成功");
                return true;
            }

        }
        return false;
    }

    public boolean exchange(String cardNo, int no) {
        for (int i = 0; i < count; i++) {
            if (c[i].cardNo.equals(cardNo)) {
                if (no == 1 && c[i].score >= 100) {
                    c[i].score -= 100;
                    System.out.println("兑换餐巾纸一包");
                    return true;
                }
                if (no == 2 && c[i].score >= 400) {
                    c[i].score -= 400;
                    System.out.println("兑换剃须刀一把");
                    return true;
                }
                if (no == 3 && c[i].score >= 1000) {
                    c[i].score -= 1000;
                    System.out.println("兑换铁锅一个");
                    return true;
                }
            }
        }
        System.out.println("兑换失败");
        return false;
    }


}
